<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<% Response.Expires=0 %>
<%
dim aa, bb,cc
aa=Request.ServerVariables("LOGON_USER")
cc=Trim(Request.Querystring("AN"))
if len(cc)=0 THEN
cc="!"& aa
cc=right(cc,24)
end if

if instr(1,aa, cc,1)=0 THEN
''response.clear
''response.end
end if

aa=Request.ServerVariables("HTTP_USER_AGENT")
bb="Indy"
if instr(1,aa, bb,1)=0  THEN
''response.clear
''response.end
end if
%>
<!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"-->
<%
dim Node,  CN, DTA, Ph, Code, Anketa

Node=request("Node")
if isEmpty(Node) then Node="_P"

CN=request("CN")
if isEmpty(CN) then CN=""
Ph=request("Ph")
if isEmpty(Ph) then Ph=""
DTA=request("DTA")
if isEmpty(DTA) then DTA=""

Code=request("Cd")
if isEmpty(Code) then Code=""

Anketa=request("Anketa")
if isEmpty(Anketa) then Anketa=""

	Dim cnn
	Dim connStr
	dim cmd
	dim R
	Set cnn=Server.CreateObject("ADODB.Connection")
    Set cmd=Server.CreateObject("ADODB.Command")
%>
<!-- #INCLUDE FILE="Connection.inc" -->
<%
''''	connStr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=Test;Password=Test;Initial Catalog=SMS"&Node&";Data Source=EM-HOME"
	cnn.open connStr
	Set cmd.ActiveConnection = cnn
	cmd.CommandType=adCmdStoredProc
	cmd.CommandText = "sp_AutomatAnketas"

	Cmd.Parameters.Append Cmd.CreateParameter("@DTA", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Phone", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Code", adVarChar, adParamInput,16)

	Cmd.Parameters.Append Cmd.CreateParameter("@AN", adVarChar, adParamInput,24)
	Cmd.Parameters.Append Cmd.CreateParameter("@CN", adVarchar, adParamInput,19)
	Cmd.Parameters.Append Cmd.CreateParameter("@Anketa", adVarchar, adParamInput,2048)

	Cmd("@DTA")=DTA
	Cmd("@Phone")=Ph
	Cmd("@Code")=Code
	Cmd("@AN")=cc
	Cmd("@CN")=CN
	Cmd("@Anketa")=Anketa

	cmd.execute
	%>
<Result>
OK
</Result>
<%
	set cmd=nothing
	cnn.close
	set cnn=nothing
%>
